#define FFI_LIB "libxxhash.so"

typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;

typedef uint32_t XXH32_hash_t;
typedef uint64_t XXH64_hash_t;

struct XXH64_state_s {
   XXH64_hash_t total_len;
   XXH64_hash_t v1;
   XXH64_hash_t v2;
   XXH64_hash_t v3;
   XXH64_hash_t v4;
   XXH64_hash_t mem64[4];
   XXH32_hash_t memsize;
   XXH32_hash_t reserved32;  /* required for padding anyway */
   XXH64_hash_t reserved64;  /* never read nor write, might be removed in a future version */
};   /* typedef'd to XXH64_state_t */

typedef struct XXH64_state_s XXH64_state_t;

extern XXH64_hash_t XXH64 (const void* input, size_t length, XXH64_hash_t seed);

extern XXH64_state_t* XXH64_createState(void);
extern XXH_errorcode  XXH64_freeState(XXH64_state_t* statePtr);
extern void           XXH64_copyState(XXH64_state_t* dst_state, const XXH64_state_t* src_state);

extern XXH_errorcode XXH64_reset  (XXH64_state_t* statePtr, XXH64_hash_t seed);
extern XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length);
extern XXH64_hash_t  XXH64_digest (const XXH64_state_t* statePtr);

typedef struct { unsigned char digest[8]; } XXH64_canonical_t;
extern void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash);
extern XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src);
